﻿Public Class clsJLJC

    Public Function insert(en As entityJLJC) As Integer
        Dim sql As String = String.Empty
        Dim rtn As Integer
        sql &= "INSERT INTO sf.b_jl_jc( factory_id , prod_date , jl_type , jp_type , "
        sql &= "lg_temp , jc_temp , sh1_temp , sh2_temp , sm_temp , xm_temp , sg_temp , xg_temp , "
        sql &= "yyjczcgj , yyjqdcgj , yyjp_temp , lqjp_temp , "
        sql &= "appearance_hlj , appearance_jp , appearance_jp_reason , appearance_jp_reason_details , "
        sql &= "note , oper , update_time) "
        sql &= "VALUES ( ? , ? , ? , ? ,"
        sql &= " ? , ? , ? , ? , ? , ? , ? , ? ,"
        sql &= " ? , ? , ? , ? ,"
        sql &= " ? , ? , ? , ? ,"
        sql &= " ? , ? , (SELECT CURRENT_TIMESTAMP(6)))"
        With en
            rtn = DBacs.ExecuteUpdateSql(sql, -1, .factory_id, .prod_date, .jl_type,
                                         .jp_type, .lg_temp, .jc_temp, .sh1_temp, .sh2_temp, .sm_temp, .xm_temp, .sg_temp, .xg_temp,
                                         .yyjczcgj, .yyjqdcgj, .yyjp_temp, .lqjp_temp,
                                         .appearance_hlj, .appearance_jp, .appearance_jp_reason, .appearance_jp_reason_details,
                                         .note, .oper)
        End With
        Return rtn
    End Function

    Public Function update(en As entityJLJC) As Integer
        Dim sql As String = String.Empty
        Dim rtn As Integer
        sql &= " UPDATE sf.b_jl_jc SET prod_date = ? , jl_type = ? , jp_type = ? , "
        sql &= " lg_temp = ? , jc_temp = ? , sh1_temp = ? , sh2_temp = ? , sm_temp = ? , xm_temp = ? , sg_temp = ? , xg_temp = ? ,"
        sql &= " yyjczcgj = ?, yyjqdcgj = ?, yyjp_temp = ? , lqjp_temp = ? , "
        sql &= " appearance_hlj = ?, appearance_jp = ?, appearance_jp_reason = ?, appearance_jp_reason_details = ?, "
        sql &= " note = ?, update_time = (SELECT CURRENT_TIMESTAMP(6))"
        sql &= " WHERE sys_id = ? "
        With en
            rtn = DBacs.ExecuteUpdateSql(sql, -1, .prod_date, .jl_type, .jp_type,
                                         .lg_temp, .jc_temp, .sh1_temp, .sh2_temp, .sm_temp, .xm_temp, .sg_temp, .xg_temp,
                                         .yyjczcgj, .yyjqdcgj, .yyjp_temp, .lqjp_temp,
                                         .appearance_hlj, .appearance_jp, .appearance_jp_reason, .appearance_jp_reason_details,
                                         .note, .sys_id)
        End With
        Return rtn
    End Function

    Public Function selectBySysid(_sysid As String) As DataTable
        Dim szSql As String = "select * from sf.b_jl_jc where factory_id=? and sys_id=?"
        Return DBacs.ExecuteSql(szSql, -1, "TS", _sysid)
    End Function


    Public Function getList(startTime As String, endTime As String) As DataTable
        Dim szSql As String = ""
        szSql &= " select a.*,b.name from sf.b_jl_jc a left join sf.t_mst_jp b on a.jp_type = b.material_code"
        szSql &= " where 1=1 "
        If startTime <> "" Then
            szSql &= " and a.update_time >= '" + startTime + "'"
        End If
        If endTime <> "" Then
            szSql &= " and a.update_time <= '" + endTime + "'"
        End If
        Return DBacs.ExecuteSql(szSql, -1)
    End Function


End Class
